package com.tqfframe.task.learning.reflection;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * Created by Tang-QiFeng on 2020/7/18
 */
public class FirstJobMain {
    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        //模拟项目启动时，把对象加入到内存中。  spring项目中，实际可以定义在SmartLifecycle接口的方法中，随项目启动加载，或者Bean中。
        RegistHandlerMap.putRegistHandlerMap("jobTest",JobTest.class);
        Class c=RegistHandlerMap.getRegistHandlerMap("jobTest");
        Constructor constructor = c.getConstructor();
        JobModel jobModel=(JobModel) constructor.newInstance();
        jobModel.execute();
    }
}
